<?php

/**
 * This is the model class for table "pemelukagama".
 *
 * The followings are the available columns in table 'pemelukagama':
 * @property integer $pa_id
 * @property integer $pa_kec
 * @property integer $pa_islam
 * @property integer $pa_katholik
 * @property integer $pa_protestan
 * @property integer $pa_hindu
 * @property integer $pa_budha
 * @property integer $pa_lainnya
 * @property integer $pa_jumlah
 * @property integer $pa_tahun
 */
class Pemelukagama extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Pemelukagama the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'pemelukagama';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('pa_kec, pa_islam, pa_katholik, pa_protestan, pa_hindu, pa_budha, pa_lainnya, pa_jumlah, pa_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('pa_id, pa_kec, pa_islam, pa_katholik, pa_protestan, pa_hindu, pa_budha, pa_lainnya, pa_jumlah, pa_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'pa_id' => 'Pa',
			'pa_kec' => 'Kecamatan',
			'pa_islam' => 'Islam',
			'pa_katholik' => 'Katholik',
			'pa_protestan' => 'Protestan',
			'pa_hindu' => 'Hindu',
			'pa_budha' => 'Budha',
			'pa_lainnya' => 'Lainnya',
			'pa_jumlah' => 'Jumlah',
			'pa_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('pa_id',$this->pa_id);
		$criteria->compare('pa_kec',$this->pa_kec);
		$criteria->compare('pa_islam',$this->pa_islam);
		$criteria->compare('pa_katholik',$this->pa_katholik);
		$criteria->compare('pa_protestan',$this->pa_protestan);
		$criteria->compare('pa_hindu',$this->pa_hindu);
		$criteria->compare('pa_budha',$this->pa_budha);
		$criteria->compare('pa_lainnya',$this->pa_lainnya);
		$criteria->compare('pa_jumlah',$this->pa_jumlah);
		$criteria->compare('pa_tahun',$this->pa_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}